Skip to content

CAMEL-13920: Allow using markup in option description - #3137

Merged
bedlaj merged 1 commit into
masterfrom
CAMEL-13920
Sep 9, 2019
Merged

CAMEL-13920: Allow using markup in option description#3137
bedlaj merged 1 commit into
masterfrom
CAMEL-13920

Conversation

@bedlaj

@bedlaj bedlaj commented Sep 3, 2019

Copy link
Copy Markdown
Contributor

This is best way, I have found so far to allow lists in description. Please review and comment, if you see some better solution, because I feel, that adding \n to javadoc is somehow incorrect.

@bedlaj
bedlaj requested review from davsclaus and zregvart September 3, 2019 20:41
|===
| Name | Description | Default | Type
@foreach{row : componentOptions}| *@{row.getShortName(25)}* (@{row.shortGroup}) | @{util.escape(row.description)} | @{row.getShortDefaultValue(20)} | @{row.getShortJavaType(25)}
@foreach{row : componentOptions}| *@{row.getShortName(25)}* (@{row.shortGroup}) @{row.description.?contains("\n") ? "a" : ""}| @{util.escape(row.description)} | @{row.getShortDefaultValue(20)} | @{row.getShortJavaType(25)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this "a" do?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davsclaus have a look at the Asciidoctor manual this helps in rendering the Asciidoc column content, without it it would render verbatim.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay is there a way to document this better in the source code so anyone knows this

@zregvart

zregvart commented Sep 4, 2019

Copy link
Copy Markdown
Member

Thanks for the pull request, now it's a bit clearer for me to see what you're trying to fix.

Does prefixing table columns with a help to render those correctly? I seem to recall that if you wanted a table to contain Asciidoc content which in turn can contain HTML you needed to use syntax like:

|===
a| *markdown* or <strong>html</strong>
|===

@zregvart

zregvart commented Sep 4, 2019

Copy link
Copy Markdown
Member

Hmm that actually doesn't work, I've tried the example I provided and it renders the <strong>html</strong> verbatim.

Another option could be to take the JavaDoc content and convert it to Markdown in the Camel package Maven plugin. Perhaps using something like remark.

@bedlaj

bedlaj commented Sep 4, 2019

Copy link
Copy Markdown
Contributor Author

I was thinking about converting HTML to markdown too, but havent found a way get full javadoc in UpdateReadmeMojo, because the model in this mojo have already stripped html tags. As Claus mentioned in Jira, it is not safe to include HTML tags in json model description, but maybe we can add to model new attribute, which will contain description with tags? Or is there already a place, where it can be obtained, which I am missing?

@davsclaus

Copy link
Copy Markdown
Contributor

Javadoc documentation is not as important as the website docs and tooling docs (eg spring boot metadata etc). So I am fine with formatting the source code so it render better on the website. I dont like having 2 set of description in the json file.

@zregvart

zregvart commented Sep 5, 2019

Copy link
Copy Markdown
Member

Perhaps we can go with this solution and then in a subsequent refinement try to modify the toolchain so that we get raw JavaDoc content including HTML in the Maven mojos so we can change format as needed: strip HTML for JSON catalog and convert to Markdown for Asciidoc files.

@bedlaj

bedlaj commented Sep 8, 2019

Copy link
Copy Markdown
Contributor Author

Agree. I will add few comments to mvel template regarding a prefix and then merge this after full local build. Current solution relies on \n, which is suitable for lists, but it will not detect inline markups - e.g. links, these are still stripped out from javadoc in current solution. I will keep the jira open, so we can eventualy find a complete solution later. Thanks for your inputs.

@bedlaj
bedlaj merged commit 370b265 into master Sep 9, 2019
@bedlaj
bedlaj deleted the CAMEL-13920 branch September 9, 2019 00:06
fvaleri pushed a commit to fvaleri/camel that referenced this pull request Oct 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants